<?php

namespace app\common\model;
use app\common\RootModel;

class ConvertModel extends RootModel
{
    protected $pk = 'id';
    protected $table = 'sys_convert';

    /**
     * 状态
     * @var string[]
     */
    public static $stateLabel = ['关闭', '启用'];

    /**
     * 钱包类型
     * @var array
     */
    public static $typeLabel = ['Momo', 'Binance', 'PayerMax'];

    /**
     * 货币类型
     * @var string[]
     */
    public static $currencyLabel = ['金币', '越南盾', 'SHIB', '钻石', 'PIX', 'PagBank', 'OVO', 'DANA', 'GoPay', 'ShoPee',
        '越南银联', '话费充值'];

    /**
     * 打款方式
     * @var string[]
     */
    public static $auditLabel = ['自动打款', '人工审核'];

    /**
     * 颜色
     * @var string[]
     */
    public static $color = ['#FF5722', '#009688'];

    /**
     * 列表
     * @return \think\model\relation\HasMany
     */
    protected function convertList()
    {
        // 筛选字段
        $fields = ['id', 'name', 'quantity', 'type', 'currency', 'duty', 'invite', '1 status', 'prompt', 'frequency',
            'read', 'chest'];
        // 筛选结果
        return $this->hasMany(self::class, 'type', 'wallet')->where(['state' => 1])
            ->field($fields)->order(['sort' => 'asc']);
    }
}